package com.service;
import java.util.ArrayList;
import java.util.List;

import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Component;

@Component
public class MyUserDetailsService implements UserDetailsService {

    
    @Override
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
    	
    	List<GrantedAuthority> userAuthorities = new ArrayList <GrantedAuthority>();
    	
    	GrantedAuthority grantedAuthority = new SimpleGrantedAuthority("admin");
    	userAuthorities.add(grantedAuthority);
    	
        User user = new User(username, "myPassword",userAuthorities);
        return user;
  }
}
